<template>
  <div>
    <PureModal fullscreen @onClose="onClose" :show="show" title="用户考试成绩">
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="id" label="序号"></el-table-column>
        <el-table-column prop="exam_id" label="考试编号" ></el-table-column>
        <el-table-column prop="exam_name" label="试卷名称" ></el-table-column>
        <el-table-column prop="start_time" label="考试时间" ></el-table-column>
        <el-table-column prop="duration" label="考试时长" ></el-table-column>
        <el-table-column prop="score" label="得分" ></el-table-column>
      </el-table>
      <el-pagination
        background
        layout="prev, pager, next, jumper"
        @current-change="handleCurrentChange"
      @size-change=handleSizeChange
        :current-page.sync="search.page"
        :page-size="search.page_size"
        :total="total"
      ></el-pagination>
    </PureModal>
  </div>
</template>
<script>
import pageMixin from "@/mixins/pageMixin";
import PureModal from "@/modals/PureModal";
import { examModel } from "@/api/models";
export default {
  mixins: [pageMixin],
  components: {PureModal},
  data() {
    return {
      total: 0,
      tableData: [],
      search: {
        page: 1,
        page_size: 10
      }
    };
  },
  props: {
    course_id: {
      type: [Number, String],
      default: null
    },
    student_id: {
      type: [Number, String],
      default: null
    },
    show: {
      type: Boolean,
      default: false
    }
  },
  mounted() {
    this.getList();
  },
  methods: {
    onClose() {
      this.$emit("onClose");
    },
    getList() {
      examModel.papers(this.course_id, this.student_id, res => {
        console.log(res)
        this.tableData = res.data;
        this.total = res.total_records;
      })
    }
  }
};
</script>
<style scoped lang="scss">
  
</style>